<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
export default {
  name: 'App',
  mounted(){
    let that = this;
    that.initGlobalDir();
    document.onkeydown = function (event) {
        if (event.altKey && event.shiftKey && event.key == 'F12') {
            that.$electron.remote.getCurrentWindow().webContents.openDevTools();
            console.log(that.$electron.remote.app.getAppPath());
        }
    }
  },
  methods: {
      initGlobalDir() {
          const path = require('path');
          let that = this;
          //全局存储数据目录
          let dataDir = this.$readIniFile('data', 'dataDir');
          console.log("now dataDir --> " + dataDir);
          if (dataDir === "self") {//代表是当前目录
              if (process.env.NODE_ENV === 'production') {
                  window.$DATADIR = path.dirname(process.execPath) + '/resources/data/';
              } else {
                  window.$DATADIR = './data/';
              }
          } else if(dataDir === "low-update"){
              window.$DATADIR = path.dirname(process.execPath) + '/html/';
          } else {
              window.$DATADIR = dataDir;
          }
          //初始化dbPath
          let dbPath = ""
          if (process.env.NODE_ENV === 'production') {
              dbPath = window.$DATADIR + that.$CONST.global.db;
          } else {
              dbPath = window.$DATADIR + that.$CONST.global.dbTest;
          }
          window.$DBDIR = dbPath;
      }
  }
};
</script>

<style>
*,
:before,
:after {
  box-sizing: border-box;
}
html,
body {
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "å¾®è½¯é›…é»‘", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  width: 100%;
  height: 100%;
  background-color: transparent;
}
body,
div,
dl,
dt,
dd,
ul,
ol,
li,
h1,
h2,
h3,
h4,
h5,
h6,
pre,
form,
fieldset,
input,
textarea,
p,
blockquote,
th,
td {
  margin: 0;
  padding: 0;
  list-style-type: none;
}
body,
div,
dl,
dt,
dd,
ul,
ol,
li,
h1,
h2,
h3,
h4,
h5,
h6,
pre,
code,
form,
fieldset,
legend,
input,
textarea,
p,
blockquote,
th,
td,
hr,
button,
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
  margin: 0;
  padding: 0;
}
input {
  width: 12px;
  height: 12px;
}

abbr,
acronym {
  border: 0;
  font-variant: normal;
}

a {
  text-decoration: none;
  color: black;
}
a:hover {
  text-decoration: none;
  color: #2389ff;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}
fieldset,
img {
  border: 0;
}
address,
caption,
cite,
code,
dfn,
em,
strong,
th,
var {
  font-style: normal;
  font-weight: normal;
}
ol,
ul {
  list-style: none;
}
caption,
th {
  text-align: left;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: 100%;
  font-weight: normal;
}
q:before,
q:after {
  content: "";
}
abbr,
acronym {
  border: 0;
}
html {
  color: #000;
  background: transparent;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  letter-spacing: 0;
  text-align: left;
}

input,
select,
textarea,
a,
span {
  outline: 0;
  margin: 0;
  border: none;
  padding: 0;
}
/*input,select,textarea{
    border: 1px solid #ddd;
    border-radius: 2px;
}*/
select {
  appearance: none;
  -webkit-appearance: none;
  text-indent: 4px;
  background-color: #fff;
}
input::-webkit-input-placeholder {
  color: #999;
}

::-webkit-scrollbar {
  background-color: #DCDFE7;
  width: 0px;
  height: 0px;
  background-clip: padding-box;
}

/*滚动条中间滑动部分*/
::-webkit-scrollbar-thumb {
  background-color: #DCDFE7;
}
</style>
